import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SzpnConfigVO, SzpnConfigForm, SzpnConfigQuery } from '@/api/business/szpnConfig/types';

/**
 * 查询szpn配置列表
 * @param query
 * @returns {*}
 */

export const listSzpnConfig = (query?: SzpnConfigQuery): AxiosPromise<SzpnConfigVO[]> => {
  return request({
    url: '/business/szpnConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询szpn配置详细
 * @param id
 */
export const getSzpnConfig = (id: string | number): AxiosPromise<SzpnConfigVO> => {
  return request({
    url: '/business/szpnConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增szpn配置
 * @param data
 */
export const addSzpnConfig = (data: SzpnConfigForm) => {
  return request({
    url: '/business/szpnConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改szpn配置
 * @param data
 */
export const updateSzpnConfig = (data: SzpnConfigForm) => {
  return request({
    url: '/business/szpnConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除szpn配置
 * @param id
 */
export const delSzpnConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/szpnConfig/' + id,
    method: 'delete'
  });
};
